package 设计模式.visitor;

import java.util.LinkedList;
import java.util.List;

public class ObjectStructure {
    private List<Person> people=new LinkedList<>();

    public void attach(Person p){
        people.add(p);
    }

    public void detech(Person p){
        people.remove(p);
    }

    public void disPlay(Action action){
        for (Person p:people) {
            p.accept(action);
        }
    }
}
